I am making a rubiks cube and cant figure out how to get the pieces to move correctly
Local rotation is your friend!  

Here's what I'd do:  


create an 'Empty' at the very center of your cubes
snap the 3d cursor to that Empty: 





Set the pivot point to '3d cursor':





Choose 'Local' rotation mode:




Then select your face cubes and rotate, using axis-constrained rotation (i.e. only one axis at a time).  If you use Local mode it shouldn't matter what crazy orientation your cube is in, your rotation will occur relative to the rotation of the cube:



If you rotate using the 3d Manipulator, it'll stay in Local mode as long as you don't change that dropdown.  If you use hotkeys, press the axis TWICE to be in local mode.  That is, press 'R', then 'X' once, then 'X' again, to rotate around the X-axis in local mode.  You can see in my image those red lines shooting out of the faces that show the axis of rotation.  

Hope this helps!