My cube gets stuck at 0 degrees rotation

I am using a quaternion to rotate my cube. In unity w is the degrees of rotation on the axis defined by x y z variables on the quaternion. I know this from looking in the source of unity that you can get on GitHub.

public class cubespin : MonoBehaviour
{
    public Transform axis;
    public float speed;
    
    Transform tf;
    Vector3 Vector;
    Vector3 vecnormal;
    Quaternion rotate;
    // Start is called before the first frame update
    void Start()
    {
        tf = GetComponent<Transform>();
    }

    // Update is called once per frame
    void Update()
    {

        //gets rotation axis
        Vector = tf.position - axis.position;

        //normalizes axis
        vecnormal = Vector.normalized;

        //sets quaternion axis of rotation
        rotate.x = vecnormal.x;
        rotate.y = vecnormal.y;
        rotate.z = vecnormal.z;
        // sets degrees of the rotation
        rotate.w += Input.GetAxis("Mouse X") * speed;
        tf.SetPositionAndRotation(tf.position, rotate);
        
    }
}

The transform I’m using for the axis is directly above the object (one unit up). I normalized it anyway.
As the rotation on the Y axis approaches 0 the rotation slows down. It stops at zero and can’t go past zero. This doesn’t happen at 180 degrees.
I tried to find how SetPostionAndRotation sets the rotation but all I could find was the Predefinition of the function. Honestly I’m out of ideas to find the solution.
I know about Euler() in unity but I doesn’t cut it for the application I wanna use rotation for.

Are you able to use this? It rotates pretty nicely with my mouse. Not sure why you need the other stuff. Rotate is doing the pretty much the same thing as SetPositionAndRotation.


    void Update()
    {
        Vector = tf.position - axis.position;
        transform.Rotate(Vector, Input.GetAxis("Mouse X"), Space.World);
    }