MouseGetPos seems to be the start of it.

This might help in some way.
https://autohotkey.com/board/topic/7...urn-to-origin/