Rendering 3D graphics within a viewport rectangle?

I am trying to create a game with windows (“Applications”) in the GUI that have specific contents and can do certain things within the game. One of these is a 3D world view with a sphere and a simple wireframe Earth texture mapped to it. However, I am unsure of how to render a 3D scene within the constraints of a “Window’s” rectangle, as this world view is not supposed to take up the whole screen. I have looked at viewports but it seems like 3D scenes are drawn based on the window bounds at all times. I am completely new to 3D programming as a whole, but have some familiarity with MonoGame.
Can anybody help?

I have not had issues using viewports, with 3D drawing or otherwise. If it isn’t working for you I suspect there is something else going on causing that. That said, you could also use RenderTargets. Something like…

(wholly untested, written from memory of class names and such, may be entirely garbage lol)

// at initialization or wherever appropriate but not every frame, only once
RenderTarget2D myRt = new RenderTarget2D(...);

// within Draw
GraphicsDevice.SetRenderTarget(myRt); // set GD to draw to RT instead of back buffer
// do some drawing that should be in the RT
GraphicsDevice.SetRenderTarget(null); // set GD to draw to back buffer (i.e. the screen)
spriteBatch.Draw(myRt, position, ...); // draw RT to screen

But really viewports should get you where you need to go, and won’t come with memory use and other small drawbacks of using RTs for this.

Thanks a lot for the reply!
I have seen others do something similar, so this seems to work in theory - however, I just tried it and it seems like my ancient integrated graphics processor doesn’t support it…
But I found a solution elsewhere - switching the GraphicsDevice viewport. Whenever I get a PC upgrade, I will be sure to return to this reply since it’s pretty helpful and concise and re-implement the RenderTarget code.
Thanks again!