Character formulas from matrix factorizations