I'm trying to place a button on the bottom right corner of the screen, so I tried to put all the Anchor parameters in the inspector to the value "End" but the position still needs to be specified relative to the top-left corner. If I try changing the margins in the inspector it kind of works but then I have to change all four margins taking into account the size.
Having a Node2D with a Button in it you need this code.
extends Node2D func _ready(): var v:Vector2 = get_viewport().size $Button.rect_position = v - $Button.rect_size
This does not look clean as the button is squeezed into the bottom right not looking great. It's better to put it in ie a MarginContainer and then move that bottom right. It's Custom constants margins can be set manually.
extends Node2D func _ready(): var v:Vector2 = get_viewport().size var m:MarginContainer = $MarginContainer m.rect_position = v - m.rect_size
Hope this was useful :-)