[2D] Looking at mouse is rotated about 90 degrees.

Hello, I don’t know what is wrong with this code but here it is:

        Vector3 dir = Input.mousePosition - Camera.main.WorldToScreenPoint(transform.position);
        float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
        transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);

And here is the problem:

        https://imgur.com/a/LtoNc

Gameobject is rotated about 90 degrees.

If you want player to look at mouse you can use this script instead:

var mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
rotation = Quaternion.LookRotation(_player.transform.position - mousePosition, Vector3.forward);