Assembling an array of polar molecules with full quantum-state control