When the game starts, when I click left on the screen, the object moves to the right instead of to the left. When I right click, it goes right again, but faster. As far as I understand, it considers the leftmost part of the screen as the middle, but why?
What you are using are the screen coordinates for your mouse onto the world coordinates for your game.
Since these are two different coordinate systems, they won’t match too well.
Try using these coordinates from your mouse for your world: