GodotBaro Your Panel appears to be under VBoxContainer. Containers control their childrens size and position. The point of VBoxContainer is to keep controls vertically one after another.
Try taking your panel out of VBoxContainer and place it under CenterContainer instead.

GodotBaro You need to use the correct functions and the correct types or it will not work. They are not interchangeable. GetViewportRect is a different function from GetViewport. There is also no need to use ints. All of the values you are dealing with are floats from start to finish. I wrote out in GDScript something like you would do that wouldn't cause these errors:

	var rect:Rect2 = get_viewport_rect()
	var container:CenterContainer = $"ScrollContainer/VBoxContainer/CenterContainer"
	var pos:Vector2 = rect.get_center()
	container.position = pos

Unfortunately, even then this code won't do what you want it to do. Containers control the positioning of their children completely. You cannot directly modify the position of the child of a VBoxContainer. You should watch some youtube tutorials on Godot's UI with Containers to make sure you understand how they function and what purpose they serve. It's very likely that you can achieve what you are trying to create without even using any code. Probably in this scenario you would want a CenterContainer as the direct child of a CanvasLayer, and then your other containers as children of that, but you will need to experiment and find out.