How can make an object follow another object without sharing the same rotation value in 2D?

I have a script called CameraRot.cs and I want to make the camera follow the square without them sharing the rotation values. How can I fix this?

public class CameraRot : MonoBehaviour
{
    public GameObject player;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        transform.position = player.transform.position;
    }
}

Your script does not cause the camera and the player to share rotation values. If they are sharing rotation values anyway, make sure that the camera is not a child object of any other object. All children inherit their parents’ rotation and apply a local rotation on top of that.