Properly take into account inverted coordinates in coordinate conversion