Lock cursor position on rotating

Hi all. Need advice about locking cursor position while rotating camera (with RMB).
I have this scheme


Can someone tell me, what i’m doing wrong?
On test if i just press RMB without moving cursor anywhere X & Y cords don’t the same before and after pressing the button

Blue values - on pressing button, red one after release.

Just so if anyone ever wonders how to do this(I was replicating camera from L2):