Any analogues of Camera3D.unproject_position in Camera2D?

Godot Version

4.3

Question

I’ve been writing a shader. I want to convert global coordinate into one relative to the upper-left corner of the screen. There is method unproject_position in Camera3D, but no such method for Camera2D. Any ways how to implement this function? Thanks!

Something like that should work, but I haven’t tested it, use with caution:

var screen_position: Vector2 = get_viewport().get_camera_2d().global_transform.affine_inverse() * global_position_to_convert