object not rotating properly with mouse movement

public class playerController : MonoBehaviour {

public float speed = 5f;
void Update ()
	Vector2 direction = Input.mousePosition - transform.position;
	float angle = Mathf.Atan2 (direction.y, direction.x) * Mathf.Rad2Deg - 90f;
	Quaternion rotation = Quaternion.AngleAxis (angle, Vector3.forward);
	transform.rotation = Quaternion.Slerp (transform.rotation, rotation, speed * Time.deltaTime);


Object is rotating perfectly if i move mouse around making large circle (large enough that its out of play area) but if i rotate the mouse around object in play area , the rotation is incomplete.

That’s because Input.mousePosition is in pixel coordinates and transform.position is in world-space units (meters if you will)

Instead you need to transform the forward direction of the object into coordinate system relative to screen (that is, the lower left corner of the screen), by doing:

//"map" the vectors onto the monitor's screen, and calculate the difference using them:
        Vector3 objectPosOnScreen = Camera.main.WorldToScreenPoint(transform.position);
        Vector3 frontOnScreen = Camera.main.WorldToScreenPoint(transform.position + transform.forward);

        //x is windth-pixels of screen, y is how many hight pixels on screen. Z is always 0
        Vector3 dirOnScreen = (frontOnScreen - objectPosOnScreen).normalized;

        Vector3 objToMouseOnScreen = (Input.mousePosition - objectPosOnScreen).normalized;


        //apply rotation like you would usually, but around the axis which points from object to camera (in world space this time):
        Vector3 axisToCamera = (Camera.main.transform.position - transform.position).normalized;

        //compute angle

        transform.rotation = Quaternion.Slerp(transform.rotation, rotation, speed * Time.deltaTime);