This kind of problem can be ugly to solve. Here is some example of one way to approach the probelm. ‘rotationAmount’ will be the positive or negative rotation from the original rotation.

using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour {
private float angle = 0.0f;
private float rotationAmount = 0.0f;
void Update() {
Vector3 dir = Input.mousePosition - Camera.main.WorldToScreenPoint (transform.position);
float newAngle = Mathf.Atan2 (dir.y, dir.x) * Mathf.Rad2Deg;
rotationAmount += Mathf.DeltaAngle (angle, newAngle);
angle = newAngle;
transform.rotation = Quaternion.AngleAxis (angle, Vector3.forward);
Debug.Log (rotationAmount);
}
}

This code assumes the initial rotation of the object is considered 0.0. In addition since ‘rotationAmount’ is calculated by adding lots of relative rotations, a small error will creep in due to floating point imprecision. Note that I’m converting the transform.position to a screen coordinate rather than the other way around like your code. The reason is that you code will only work (as is) for an Orthographic camera. This code will work for perspective as well.

You can divide by 360 and take the floor to get the number of positive or negative rotations if all you want is the count of rotations.

Final note. Avoid direct comparisons of floating point numbers as in this line:

There is nothing internal that has that information saved, so you have to calculate it based on how many full rotations you’ve made previously.

Create a variable that saves the rotation from the previous frame and one that saves the rotation from the current frame, then if there difference is say, more than 270 add to your full rotations variable, if it is less than -270, minus from your full rotations variable!

Then when last frame the angle was near 0 and then it became near 360, you minus a full rotation, and vice versa.

Then you can get your rotation by doing rotation = 360*fullRotations + currentRotation;

Scribe

EDIT: based on your code you don’t allow your object to rotate more than 6 degrees every frame so there would be no problem with this method, as this method only breaks if you rotate more than 270 degrees in a frame. Here’s how it might look with your code: