### 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_READ_THREAD_GUARD_V(SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED);
	ERR_FAIL_INDEX_V(p_quadrant, 4, SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED);
	return positional_shadow_atlas_quadrant_subdiv[p_quadrant];
}
Ref<InputEvent> Viewport::_make_input_local(const Ref<InputEvent> &ev) {
	if (ev.is_null()) {
		return ev; 
	}
	Transform2D ai = get_final_transform().affine_inverse();
	return ev->xformed_by(ai);
}
Vector2 Viewport::get_mouse_position() const {
	ERR_READ_THREAD_GUARD_V(Vector2());
	if (!is_directly_attached_to_screen()) {
		
		
		return gui.last_mouse_pos;
	} else if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_MOUSE)) {
		return get_screen_transform_internal(true).affine_inverse().xform(DisplayServer::get_singleton()->mouse_get_position());
	} else {
		
		return get_screen_transform_internal().affine_inverse().xform(Input::get_singleton()->get_mouse_position());
	}
}
void Viewport::warp_mouse(const Vector2 &p_position) {