Step 1: Call in some help.
Open your image in gimp.
To get some help to see if you straighten the photograph well make sure the grids are visable.
Go to View > Show Grid
If the grid is too big are small go to Image > Configure Grid and change the value for Spacing.
Step 2: Remove perspective distortion.
Go to Filter > Transform Tools > Perspective
Drag the upper left-hand side outward until is approximately good, but make sure you keep the horizontal lines straight so you don't distort it.
Do the same at the right-hand side.
You'll notice that the left-hand site has moved a little so drag it outward again. And if needed the right-hand site again.
Hit Transform in the Perspective window and you're finished.
Not needed but useful: Remove the parts of the image that are out of the frame by choosing Image > Flat Image. If you don't do this step you'll have to export before the image can be saved as jpg.