Well I think the answer is in your question.
The trick is to have the centre of each cube placed in the very center of the whole rubicube. You can achieve this by moving the center (CTR mode) to the rubicube center, or by creating a null for every cube, the null placed at the center. So every cube turns perfectly around the center.
Notice that the middle cubes never end up to the corners.
If you animate them, do your rotations in GBL mode, as the center of each cube will point to different directions.
Hope this helps
Bernard Lebel