### Godot version

 v4.0.beta11.official.91713ced8

### System information

macOS 12.6.1 Monterey, Apple M1 Pro

### Issue description

After reopening scenes with Sprite2D and trying to edit the region of the sprite again the Godot app crashed.

### Steps to reproduce

1. Open scene node_2d in the project files
2. Go to Sprite2D and click on edit region, pop up should show
3. Close the popup and close the scene with X on the tab
4. Reopen the scene, go to Sprite2D and click on Edit region
5. Godot should crash

### Minimal reproduction project

[region_crash.zip](https://github.com/godotengine/godot/files/10400566/region_crash.zip)

if (atlas_tex.is_valid()) {
								undo_redo->add_do_method(atlas_tex.ptr(), "set_region", rect);
								undo_redo->add_undo_method(atlas_tex.ptr(), "set_region", atlas_tex->get_region());
							} else if (node_sprite_2d) {
								undo_redo->add_do_method(node_sprite_2d, "set_region_rect", rect);
								undo_redo->add_undo_method(node_sprite_2d, "set_region_rect", node_sprite_2d->get_region_rect());
							} else if (node_sprite_3d) {
								undo_redo->add_do_method(node_sprite_3d, "set_region_rect", rect);
								undo_redo->add_undo_method(node_sprite_3d, "set_region_rect", node_sprite_3d->get_region_rect());
							} else if (node_ninepatch) {
								undo_redo->add_do_method(node_ninepatch, "set_region_rect", rect);
								undo_redo->add_undo_method(node_ninepatch, "set_region_rect", node_ninepatch->get_region_rect());
							} else if (obj_styleBox.is_valid()) {
								undo_redo->add_do_method(obj_styleBox.ptr(), "set_region_rect", rect);
								undo_redo->add_undo_method(obj_styleBox.ptr(), "set_region_rect", obj_styleBox->get_region_rect());
							}
							undo_redo->add_do_method(this, "_update_rect");
							undo_redo->add_undo_method(this, "_update_rect");
							undo_redo->add_do_method(edit_draw, "queue_redraw");
							undo_redo->add_undo_method(edit_draw, "queue_redraw");
							undo_redo->commit_action();
							break;
						}
					}
				} else if (edited_margin < 0) {
					drag_from = mtx.affine_inverse().xform(mb->get_position());
					if (snap_mode == SNAP_PIXEL) {
						drag_from = drag_from.snapped(Vector2(1, 1));
					} else if (snap_mode == SNAP_GRID) {
						drag_from = snap_point(drag_from);