how can I create a quad from script?

How can I create a quad from script with a specific texture attached on it as it will mainly used for rendering 2D stuffs with orthographic camera instead of using GUITexture which is really expensive if there are loads of GUITexture objects on iPhone..

You would do so through the Mesh class

You can do it that way :

var go = GameObject.CreatePrimitive(PrimitiveType.Quad);
go.renderer.material.mainTexture = texture;

Today I asked the same question.
Here how create a custom quad:

public class CustomQuad : MonoBehaviour
    {
        private Mesh _mesh;
        private float width = 2f;
        private float height = 2f;
        void Start()
        {
            var mf = GetComponent<MeshFilter>();
            _mesh = new Mesh();
            mf.mesh = _mesh;
    
            var vertices = new Vector3[4];
    
            vertices[0] = new Vector3(0, 0, 0);
            vertices[1] = new Vector3(width, 0, 0);
            vertices[2] = new Vector3(0, height, 0);
            vertices[3] = new Vector3(width, height, 0);
    
            _mesh.vertices = vertices;
    
            var tri = new int[6];

            tri[0] = 0;
            tri[1] = 2;
            tri[2] = 1;
    
            tri[3] = 2;
            tri[4] = 3;
            tri[5] = 1;
    
            _mesh.triangles = tri;
    
            var normals = new Vector3[4];
    
            normals[0] = -Vector3.forward;
            normals[1] = -Vector3.forward;
            normals[2] = -Vector3.forward;
            normals[3] = -Vector3.forward;
    
            _mesh.normals = normals;
    
            var uv = new Vector2[4];

            uv[0] = new Vector2(0, 0);
            uv[1] = new Vector2(1, 0);
            uv[2] = new Vector2(0, 1);
            uv[3] = new Vector2(1, 1);
    
            _mesh.uv = uv;
        }

        private void OnDrawGizmos()
        {
            Gizmos.color = Color.cyan;
            Gizmos.DrawWireMesh(_mesh, Vector3.zero);
        }
    }