of all, take a good look of the photo and decide what kind of perspective
correction you need. In the sample picture, the building tilts backward
and a bit to the right.
In order to define horizontal and vertical more easily, put Guide
Lines onto the image. Click the Ruler on the sides of
the image window, and drag onto the picture. If you cannot see the
ruler, turn it on by pressing Ctrl+R. Drag the upper (horizontal)
ruler for horizontal guidelines and the side (vertical) ruler for
vertical ones. You should align the vertical guidelines with the
sides of the building's base, and the horizontal ones with any line
in the picture that you wish to make horizontal (e.g. roof edges).
Click View/Clear Guides to clear misplaced guidelines.
Press Ctrl+A to select the whole image and Ctrl+T
to select Free Transform.
Note: Photoshop also contains a Perspective feature
(under Edit/Transform/Perspective) for this purpose but
Free Transform provides much more options.
Free Transform draws a border around the picture, with handles
on the corners and midpoints. In the Navigator window, shrink
the picture until it fits well in the middle of the screen. By dragging
the handles of the upper corners, pull them until the edges of the
building get parallel with the guidelines. You can drag all handles
freely to transform the image as you like. When performing perspective
correction, the lower handles are rarely needed.
you got the building straight, press Enter to make Photoshop
render the image anew and make your changes effective. Click View/Clear
Guides to clear the guidelines and behold the result:
photoshop keyboard stickers
Free Photoshop Tutorial: Perspective correction II. (hungarian)
Free Photoshop Tutorial: Perspective correction III. (hungarian)