Maximum transversal in partial Latin squares and rainbow matchings