Creating a 3D Cube
Create a new document, 1000x1000 (I usually use this resolution) white background.
Using the rectangular marquee tool, create a square and fill it with gradient. I used Linear gradient, #0562ff to white. Right click and select "Layer via copy".
Press Ctrl/Cmd+T to enter free-transform mode. Right click (or Command+Click on Mac) when the dropdown menu appears, select SKEW. Click on the right middle square and drag up until you get your desired angle. Press Enter(Return on Macintosh) to apply the transformation. Duplicate the layer.
Enter free transform again (Ctrl/Cmd+t) Right click and this time select FLIP HORIZONTAL. Drag out the copy to the left. Hold down the shift key to keep the baselines aligned. You may also want to make this side a bit thinner by clicking the left middle square (node) and drag it in a little bit.
Create a new layer and make another square and fill it with the same gradient, this time make the lightest color at the bottom left. This time while in the free transform mode... when you right click(Cmd click on the Mac) select DISTORT drag each corner until you get a good match. Be sure the corners fit nice and snug. This step will take a bit of practice to master.
Go to Image>Adjustments>Levels or just press CTRL+L (Cmd+L on the Mac) to bring up the Levels dialogue. Move the middle slider to the right to darken up the mid-tones. Repeat for the left side. This step adds more realistic lighting to the cube. Do the same for the layer that contains the top of the cube.
A complete cube. Don't limit yourself to just cubes. You can use this effect for all kinds of shapes. You can even construct a cube out of pictures. Just use images instead of the gradients. For example, I took a personal photo, I made it square, and with CTRL+T and distort I put it over the cube, than I changed the blending layer mode to "Luminosity". You can play around as long as you like, until you reached the desired effect.