Why do cubic nanoparticles favor a square array? Mechanism of shape-dependent arrangement in nanocube self-assemblies