Are those buildings leaning worse than the Tower of Pisa? The effect is called convergence and can be corrected in-camera with a special Tilt-Shift Lens. But, it is simple enough to fix in Photoshop.
1. Plan your shot
If you pay attention, you can see the effect when you are taking the picture. You can try to tilt the front of the camera to minimize the effect (similar to a Tilt-Shift lens), but that will only get you so far. Instead, be sure to add extra room around the subject to allow extra material for the Photoshop editing.
2. Use Guides as references for right angles
The building should have right-angles. But, with the Guides in place on each side, we can see the degree of distortion.
3. Start with a Perspective Transformation
After zooming out to give me extra room in Photoshop, I renamed the default “Background” layer by double clicking on the name. You can not apply a transform to the Background layer. Next, I went to Edit > Transform > Perspective. This transform is special; the opposite handles will mirror each other. By pulling the upper right corner to the right, the upper left corner will be pulled in a equal amount in the opposite direction.
4. Tweak further with Distort
Perspective Transformation will get you close to the proper state. But, chances are you will need to fix it a little more. This time I used Edit > Transform > Distort to freely adjust each handle independently. As you can see above, the right side needed much more adjustment than the left side.
5. Check the other objects in the photo
So the building is straight, but what did it do to the other objects in the photo. The taxi in front of the building is now very looooong.
6. Free Transform to correct the proportions
I next used Edit > Free Transform to bring in the sides and stretch the top of the photo. This will put the taxi in proper proportions. One last problem — the lower right corner is empty and showing the layer underneath. You can either clone (using the Vanishing Point Tool) to fill this area or just crop it away.
The final result looks very professional without having to spend a few thousand dollars on a special Tilt-Shift Lens.