Image becomes stretched when moving camera rect around it

A strange problem:
An image larger than the screen becomes stretched when I move camera rect towards its left border (without reaching or crossing image’s borders).

In this example an image (taken from lazyfoo’s tutorial) has a size 1000x800y and the screen is 640x512y.

With camera rect position {0,0,SCREEN_WIDTH, SCREEN_HEIGHT} (the upper-left corner), the image looks fine but if I set camera rect (changing only X-axis) to a position 340, 0, 340+SCREEN_WIDTH, SCREEN_HEIGHT, it becomes stretched.

Any ideas why this happens and how to prevent it?

Here is an example code which switches between those positions (stretching can be seen most easily in those shapes of the right-bottom corner) and the image file (it has compiling command in the beginning):
(URLS REMOVED)

An SDL_Rect is {xpos,ypos,width,height} so shouldn’t you be changing only the xpos, not also the width? Maybe you assumed it’s like a Windows rect {left,top,right,bottom}, but it’s not! Try 340, 0, SCREEN_WIDTH, SCREEN_HEIGHT.

Okay thanks, preliminary tests suggests that it was not more complicated than that. I could not doubt such a fundamental error because scrolling the camera worked most of time so it did not felt like being anything fundamental…