How to screenshot only part of the canvas with RenderTargetTexture

Hello guys,
Let’s say I have a box with a certain width and height (which is not constant,dimensions might change) and I need to take a screenshot of it zoomed in as much as possible while fitting the whole box in the screenshot and keeping aspect ratio? Camera needs to be orthographic. I can make the box fit in the screenshot but I get a lot of dead space to keep the canvas ratio and it doesn’t look good.

Hmmm I don’t think there is a way besides “cropping” your screenshots in another pass :confused:

How can I crop my screenshots via code? Any suggestions?

I think the easiest method would be with drawImage on canvas: CanvasRenderingContext2D.drawImage() - Web APIs | MDN (