A unified framework for high-dimensional analysis of $M$-estimators with decomposable regularizers