translates the device coordinates to the logical ones.