Quaternion Euler and Slerp: subtracting degrees only works up to a certain angle

This is hard to describe. I’m triggering rotations in my character as it runs (up walls and onto “ceilings”, like an Escher painting), subtracting degrees from its current rotation. But after 135°, it starts rotating the wrong direction.

	void Update () {
        if (rotating)
        {
            player.transform.rotation = Quaternion.Slerp(player.transform.rotation, target, Time.deltaTime * smooth);
            if (Mathf.Round(Quaternion.Angle(player.transform.rotation, target)) == 0)
            {
                rotating = false;
            }
        }
    }

    void OnTriggerEnter(Collider other)
    {
        target = Quaternion.Euler(player.transform.rotation.eulerAngles.x - 45f, 0, 0);
        rotating = true;
    }

So what’s the right way to do this? I’ve searched around for an hour but I don’t know how to describe the problem well enough, looks like.

Here’s a sample video of the problem in action.