Quantum System Partitioning By Block-Diagonalization