Poles and zeros of matrices of rational functions