Detecting cubes
(based on squares.cpp sample)