How can I have the UI scale to the camera viewport rect instead of the screen width and height?

All of the panel settings seem to apply to screen dimensions. I also tried manually setting the panel.visualtree’s style.width/height/left/top values manually, but this also didn’t have the desired effect.

Setting the visualTree’s values didn’t work, but I was able to set the rootVisualElement’s values successfully.