### Godot version

4.2 dev3

### System information

Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (NVIDIA; 30.0.15.1403) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

### Issue description

Basically variation of #33995

### Steps to reproduce

1. Open 2D scene
2. Drag a guide
3. Undo
4. Save

### Minimal reproduction project

N/A
if (drag_selection.size() > 0) {
					drag_type = DRAG_ROTATE;
					drag_from = transform.affine_inverse().xform(b->get_position());
					CanvasItem *ci = drag_selection[0];
					if (ci->_edit_use_pivot()) {
						drag_rotation_center = ci->get_global_transform_with_canvas().xform(ci->_edit_get_pivot());
					} else {
						drag_rotation_center = ci->get_global_transform_with_canvas().get_origin();
					}
					_save_canvas_item_state(drag_selection);
					return true;
				}
			}
		}
	}
	if (drag_type == DRAG_ROTATE) {
		
		if (m.is_valid()) {
			_restore_canvas_item_state(drag_selection);
			for (CanvasItem *ci : drag_selection) {
				drag_to = transform.affine_inverse().xform(m->get_position());
				
				bool opposite = (ci->get_global_transform().get_scale().sign().dot(ci->get_transform().get_scale().sign()) == 0);
				ci->_edit_set_rotation(snap_angle(ci->_edit_get_rotation() + (opposite ? -1 : 1) * (drag_from - drag_rotation_center).angle_to(drag_to - drag_rotation_center), ci->_edit_get_rotation()));
				viewport->queue_redraw();
			}
			return true;
		}
		
		if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && !b->is_pressed()) {