The easiest way THAT I KNOW (which tells you I don't know jack) of is to use the marquee selection tool (the upper left corner of the tool bar), select the size you want, then fill the square or rectangle with your foreground color by hitting option-delete on your keyboard. (Now, if you want a square or rectangle with a border but not as a filled up with one color space, then I can't remember how to do it other than to draw a line four times in a close zoom to make sure you keep it straight and to the correct number of pixels you want.)
Another way you could do it as follows: Let's say you wanted a black square 400 x 400 pixels wide with a 5 pixel border. You could make a new file sized at 400 x 400 with a white background. Make your foreground color black. Select all and option-delete to fill (so all is black). Now change your foreground color to white. Now double click the marquee tool to set to a fixed size which you would make 395 x 395. Click in the picture in such a way as to make it sit exactly five pixels from each side border of your all-black picture, then hit option-delete again to fill the center portion white, leaving a black square around the outside. Then save the picture. To use the black square elsewhere, use the magic wand to select the black color only and then hit copy, and then paste it to a new file, with transparent as the background (or simply copy and paste into the picture you want to use it in at the time and don't bother saving it as a new file, but rather going back to the black square around white middle picture whenever you wanted.)
Now, I am a Photoshop beginner, therefore this is most certainly NOT the easiest way to do this, but it is a way I am aware of.