Draw not drawing within the bounds of the Control node

Godot Version

4.2.2

Question

I have a scene where a texture rect contains a Control node and that control node contains a label node. My goal is to move the label node within the bound of its parent control node (i wanted to test another issue i still haven’t solved: Logic to keep control node within the borders of its parent control node).
Anyway, in order to assess if the label stayed within the bounds I used the draw function but the rectangle is not matching the position of the control node.
I drew in red where the control node is approximately situated.

Here is the code for drawing the rectangle:

func _draw():
	draw_rect(Rect2(global_position.x, global_position.y, size.x, size.y), Color.AQUA)

Within _draw use local coordinates and not global coordinates.

By the way, what you want for your first issue (keep child nodes inside parent control area) can be easily done using Containers

Using Containers — Godot Engine (stable) documentation in English

I assume using just position? I tried it has the same behaviour

The top left corner of the Control node should have the coordinate Vector2(0, 0).

Thank you!

func _draw():
	draw_rect(Rect2(0, 0, size.x, size.y), Color.AQUA)

did the trick.
I thought that nodes’ position was determined by their position in the viewport but apparently not. That might my other post as well