### Godot version

v4.0 rc6

### System information

Windows 10

### Issue description

When using a ViewportTexture from a SubViewport on a TextureRect, it throws errors after running the scene once and then switching scenes in the editor.
![Pasted image 20230227212626](https://user-images.githubusercontent.com/44676282/221680047-984fa03e-33d1-4856-9a7f-1700b28423cf.png)


### Steps to reproduce

Run the canvas-scene once.
Switch to another scene in the editor.
Switch back to the canvas-scene

### Minimal reproduction project

[ViewportTextureError.zip](https://github.com/godotengine/godot/files/10844099/ViewportTextureError.zip)

ERR_READ_THREAD_GUARD_V(SDF_SCALE_100_PERCENT);
	return sdf_scale;
}
Transform2D Viewport::get_screen_transform() const {
	ERR_READ_THREAD_GUARD_V(Transform2D());
	return get_screen_transform_internal();
}
Transform2D Viewport::get_screen_transform_internal(bool p_absolute_position) const {
	ERR_READ_THREAD_GUARD_V(Transform2D());
	return get_final_transform();
}
void Viewport::update_mouse_cursor_state() {
	
	Window *base_window = get_base_window();
	if (base_window) {
		base_window->update_mouse_cursor_state();
	}
}
void Viewport::set_canvas_cull_mask(uint32_t p_canvas_cull_mask) {
	ERR_MAIN_THREAD_GUARD;
	canvas_cull_mask = p_canvas_cull_mask;
	RenderingServer::get_singleton()->viewport_set_canvas_cull_mask(viewport, canvas_cull_mask);
}
uint32_t Viewport::get_canvas_cull_mask() const {
	ERR_READ_THREAD_GUARD_V(0);
	return canvas_cull_mask;
}
void Viewport::set_canvas_cull_mask_bit(uint32_t p_layer, bool p_enable) {