Rewrote writevmf completely

writevmf now uses a new approach to merge planes of equal length into a
single, rectangular formation, if possible.