We consider a regression model where the coefficients vary across unknown groups. The groups are determined by an unknown partition of the covariate space, and the elements of the partition are in the form of unions of contiguous axis-aligned hyperrectangles. Such a structure allows us to develop a new estimation procedure based on the regression tree algorithm that consistently recovers the unknown group structure and the group-specific coefficients. Moreover, if the number of groups is small, the procedure has the oracle property.