Repository: godot
Issue: Post-processing, screen-reading shaders create black rectangles in VR
Labels: discussion,topic:rendering,topic:xr,topic:3d

### Godot version

4.0.2-stable

### System information

Windows 11, Intel Core i7-12650H, Nvidia RTX3070 - Driver 531.41 - Vulkan

### Issue description
I'm experiencing issues when applying a custom post-processing shader in VR. Specifically, I'm trying to use a nearest-neighbor downscaler for a pixelated look, but when applied to the XR camera, a black rectangle appears in the top left corner of the "screen," the size of which depends on the size of the former game window. I'm not sure if this is an expected behavior or if I'm missing something.

#### Expected Behaviour (rendered via standard 3D camera)
The nearest-neighbor downscaler should be applied to the screen without any additional artifacts or distortions.
![3D_processed](https://github.com/godotengine/godot/assets/42769107/f951708b-e647-4792-8d8d-7a97672e764d)

#### Actual Behaviour (rendered via XR camera)
A black rectangle appears in the top left corner of the screen.
![VR_processed](https://github.com/godotengine/godot/assets/42769107/21d390b7-b517-42a1-adc0-0fb0838c9f2f)

#### Godot forum
I've gone ahead and created a thread on the [Godot forum](https://godotforums.org/d/34082-post-processing-in-vr), but haven't received any pointers to this issue. Leads me to believe this is worthy enough for a Github issue ^^

### Steps to reproduce
- Apply a custom post-processing shader (code provided below) to an XR camera in a VR environment by the use of a CanvasScreen and ColorRect.
- Observe the black rectangle that appears in the top left corner of the screen when launched in VR.

#### Scene setup
![Screenshot 2023-05-07 201436](https://github.com/godotengine/godot/assets/42769107/56773f3d-a5a1-46b5-a15f-4cff16ae0f5a)
#### Settings for the ColorRect
![Screenshot 2023-05-07 201459](https://github.com/godotengine/godot/assets/42769107/91dd23a1-9220-4ce5-b664-5ca196b26abb)
#### Screen-reading shader code
```shader_type canvas_item;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, repeat_disable, filter_nearest;
void fragment() {
        vec2 screen_size = 1.0/SCREEN_PIXEL_SIZE;
        // converts UV-coordinates (0-1) to pixel-coordinates (e.g. 0-1920, 0-1080), scales them down by 25%
        // afterwards those "stepped" coordinates are converted back to uv-coordinates
        vec2 uv = vec2(floor((SCREEN_UV.x*screen_size.x)/4.0)/screen_size.x, 
                floor((SCREEN_UV.y*screen_size.y)/4.0)/screen_size.y)*4.0;
        // takes one square of 16x16px and paints it with the mean colour.
        vec3 col = texture(SCREEN_TEXTURE, uv).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(SCREEN_PIXEL_SIZE.x	, 0.0)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(0.0					, SCREEN_PIXEL_SIZE.y)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(SCREEN_PIXEL_SIZE.x	, SCREEN_PIXEL_SIZE.y)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(SCREEN_PIXEL_SIZE.x*2.0, 0.0)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(SCREEN_PIXEL_SIZE.x*2.0, SCREEN_PIXEL_SIZE.y)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(SCREEN_PIXEL_SIZE.x*2.0, SCREEN_PIXEL_SIZE.y*2.0)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(0.0					, SCREEN_PIXEL_SIZE.x*2.0)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(SCREEN_PIXEL_SIZE.x	, SCREEN_PIXEL_SIZE.x*2.0)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(SCREEN_PIXEL_SIZE.x*3.0, 0.0)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(SCREEN_PIXEL_SIZE.x*3.0, SCREEN_PIXEL_SIZE.y)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(SCREEN_PIXEL_SIZE.x*3.0, SCREEN_PIXEL_SIZE.y*2.0)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(0.0					, SCREEN_PIXEL_SIZE.y*3.0)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(SCREEN_PIXEL_SIZE.x	, SCREEN_PIXEL_SIZE.y*3.0)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(SCREEN_PIXEL_SIZE.x*2.0, SCREEN_PIXEL_SIZE.y*3.0)).xyz*0.0625;
        col += texture(SCREEN_TEXTURE, uv + vec2(SCREEN_PIXEL_SIZE.x*3.0, SCREEN_PIXEL_SIZE.y*3.0)).xyz*0.0625;
    COLOR.xyz = col;
}
```

If any additional info is needed, I'm happy to supply more details.
Many thanks in advance! :3

### Minimal reproduction project

N/A