Help with top-down camera SDL3

I am attempting to recreate my simple RTS game from libGDX in SDL3. I have been messing around with setting a background texture the size of my world and then using a SDL_FRect as a viewport. So far this approach works out but whenever the viewport pans over the texture, the texture starts to stretch and becomes distorted. I know im missing something but I cant quite figure it out. I realized that libGDX did a lot of the leg-work when it comes to window and viewport rendering compared to SDL3.

Camera

Camera(int pWidth, int pHeight, int pWorldWidth, int pWorldHeight)
    {
        mWorldWidth = pWorldWidth;
        mWorldHeight = pWorldHeight;
        mViewport = {0, 0, (float)pWidth, (float)pHeight};
    }

Where camera and the world texture are rendered

void renderWorld() 
    {
        SDL_FRect dst = {0,0,WORLD_WIDTH, WORLD_HEIGHT};

        SDL_RenderTexture(mRenderer, mWorldTexture, &mCamera->getViewport(),&dst);
    }

I apologize if this is a duplicate question, I honestly could not find a thread that wasnt “heres how to have the camera follow the player”.

I think SDL_RenderTexture just clamps the srcrect to make sure it’s within the dimensions of the texture without doing the corresponding adjustments to the dstrect which means that if parts of mCamera->getViewport() falls outside the mWorldTexture it would get stretched/distorted like you said.

this might be some help
I’ve only glanced at it

the full source code isn’t there (they sale the full code on itch.io for $1.00)
but maybe there’s enough code so that you figure out the rest