Geometry-driven out-of-plane magnetization states in nanostructures