Suppose a camera always follows a cube - how do you set the cube to be exactly the size of the camera’s viewing pane at a distance away?
You can set up a plane orthogonal to the camera viewing direction in the same distance as the cube. Then you can make ray casts through the four corners of your view plane to find the corresponding four points in world space.
Then you can use those four points to adapt your cube geometry. The details depend on which parts of the cube you want to align with the view plane.