how could I do the thing I want to do?
in the example is just a hole in the rectangle, so you can see through it, I do something like this in GMS2 to make a fast illumination system that runs well with many lights on a low end mobile device
in GameMaker I use a surface for this, i think a viewport is the equivalent in Godot. In GM I use the blend modes to obscure the window and then draw light sprites in substract mode to make some places more visible, the result is something like this

that's an example I made for GMS2 if you find it useful
https://github.com/AlecAcosta/Lights