As I said: For the compartments, I cut the foam along my markings, taking care not to go to deep, and then used a pair of tailor's scissor to cut off the foam cube from the actual tray.
Basically, I did some cuts using my retractable knife which I set to about 2/3 of the foam's thickness. After that, I simply bent the foam a little and cut the cube off with a pair of scissors.