Correctly calculating mouse position