Rotating a 2D object to look at mouse position is not entirely accurate

Hi all, I am making a top down 2D game and I am using the following script to rotate an object to look at the mouse position

Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
difference.Normalize();
float rotZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0f, 0f, rotZ);

The problem is that the rotation is completly accurate and drifts out as you rotate around the character. It seems to be perfect at 45 degree angles, but not at 90… is there a more accurate way of calculating rotation along the Z axis to mouse position?

Turns out I needed to change the hotspot values in the project settings for the cursor. For reference, 15 and 15 worked for me.