Crystal structures of transition metal pernitrides predicted from first principles