Rotate Cube with with mouse

Hi

I found the script below here in the forum. It works great but it turns the object around itself, means, once it’s back is front, moving the mouse up becomes down and the other way around. I would need to modify it to use Space.World but can not figure it out.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RotateCube : MonoBehaviour
{

    public float speed;
    public float friction;
    public float lerpSpeed;
    private float xDeg;
    private float yDeg;
    private Quaternion fromRotation;
    private Quaternion toRotation;

    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            xDeg -= Input.GetAxis("Mouse X") * speed * friction;
            yDeg -= Input.GetAxis("Mouse Y") * speed * friction;
            fromRotation = transform.rotation;
            toRotation = Quaternion.Euler(yDeg, xDeg, yDeg - xDeg);
            transform.rotation = Quaternion.Lerp(fromRotation, toRotation, Time.deltaTime * lerpSpeed);
        }
    }
}

Is it possible to return the cube to a perspective rotation after you stop clicking on the screen?

Someone to hlep me?