Correlated-basis method for shell-model calculations