### 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)

Ref<Texture2D> base_tex = nullptr;
	if (atlas_tex.is_valid()) {
		base_tex = atlas_tex->get_atlas();
	} else if (node_sprite_2d) {
		base_tex = node_sprite_2d->get_texture();
	} else if (node_sprite_3d) {
		base_tex = node_sprite_3d->get_texture();
	} else if (node_ninepatch) {
		base_tex = node_ninepatch->get_texture();
	} else if (obj_styleBox.is_valid()) {
		base_tex = obj_styleBox->get_texture();
	}
	if (base_tex.is_null()) {
		return;
	}
	Transform2D mtx;
	mtx.columns[2] = -draw_ofs * draw_zoom;
	mtx.scale_basis(Vector2(draw_zoom, draw_zoom));
	RS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(), mtx);
	edit_draw->draw_rect(Rect2(Point2(), preview_tex->get_size()), Color(0.5, 0.5, 0.5, 0.5), false);
	edit_draw->draw_texture(preview_tex, Point2());
	RS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(), Transform2D());
	const Color color = get_theme_color(SNAME("mono_color"), SNAME("Editor"));
	if (snap_mode == SNAP_GRID) {
		const Color grid_color = Color(color.r, color.g, color.b, color.a * 0.15);
		Size2 s = edit_draw->get_size();
		int last_cell = 0;