This is called general linear model (not to be confused with the generalized one) also known as multivariate linear regression model.
$$ \mathbf{ Y = X B + \varepsilon } $$
where all $\mathbf{Y}$, $\mathbf{X}$, $\mathbf{B}$, and $\mathbf{\varepsilon}$ are matrices. It is fitted with ordinary least squares, same as linear regression. See also Linear model vs general linear model and Why do we need multivariate regression (as opposed to a bunch of univariate regressions)? and other questions tagged as multivariate-regression.
In R you can use the lm
function for it, but just provide the dependent variable as a matrix. You can find example of usage in the documentation.