Engineering two-dimensional electronics by semiconductor defects