Remapping mouseposition.x to rotation

Hey Guys,
so I am trying to have my object spin according to where the mouse is on the x axis. So when my mouse is on the very left, the rotation should be -90 around the z axis, when on the very right it should be 90. But it doesn’t seem to work. Here is my code:

public class PlayerController : MonoBehaviour {

	void Update () 
	{
		Quaternion currentRotation = transform.rotation;
		currentRotation.z = Map (Input.mousePosition.x, 0, Screen.width, -90, 90);
		transform.rotation = currentRotation;
	}

	public float Map (float value, float from1, float to1, float from2, float to2) {
		return (value - from1) / (to1 - from1) * (to2 - from2) + from2;
	}
}

Map() is just a function to map the mouseposition into the range -90 to 90.

Use transform.eulerAngles instead of Quaternion:

transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(-90, 90, Input.mousePosition.x / Screen.width));