### Godot version

v4.1.1.stable.official.bd6af8e0e

### System information

Windows 10.0.19045 - Vulkan (Compatibility) - GeForce GT 540M- Intel Core i7-2670QM CPU @ 2.20GHz (8 Threads)

### Issue description

Making the root window borderless, resizing it to full screen size, and hen minimizing it with display/window/stretch/mode set to viewport in project settings, causes a weird "affine_invert: Condition det == 0 is true" error to appear from one to three times in the console.


https://github.com/godotengine/godot/assets/84321760/e753b201-d411-49d4-94fc-c2d5f331c68c



### Steps to reproduce

0. Use the minimal reproduction project.
1. Run the project.
2. Once the game resizes to full screen, defocus it to make the script minimize it.
3. Observe the error in the console.

### Minimal reproduction project

[Affine-Invert-Window-Problem-Test-4.1.1.zip](https://github.com/godotengine/godot/files/12131401/Affine-Invert-Window-Problem-Test-4.1.1.zip)

ERR_MAIN_THREAD_GUARD_V(nullptr);
	
	_gui_sort_roots();
	for (List<Control *>::Element *E = gui.roots.back(); E; E = E->prev()) {
		Control *sw = E->get();
		if (!sw->is_visible_in_tree()) {
			continue;
		}
		Transform2D xform;
		CanvasItem *pci = sw->get_parent_item();
		if (pci) {
			xform = pci->get_global_transform_with_canvas();
		} else {
			xform = sw->get_canvas_transform();
		}
		Control *ret = _gui_find_control_at_pos(sw, p_global, xform);
		if (ret) {
			return ret;
		}
	}
	return nullptr;
}
Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_global, const Transform2D &p_xform) {