Hypergeometric functions of many matrix variables and distributions of generalized quadratic forms